<template>
		<s-layout  title="审核结果"   color='#3D3D3D'
			onShareAppMessage>
			<view class="main">
				<!-- 审核中 -->
				<image class="img" src="https://xyh-static-app.oss-cn-hangzhou.aliyuncs.com/storage_2/storage/qt/202405081018314356.png" mode="aspectFill" v-if="auditStatus==0"></image>
				
				<image class="img" src="https://xyh-static-app.oss-cn-hangzhou.aliyuncs.com/storage_2/storage/qt/202405271604429477.png" mode="aspectFill" v-if="auditStatus==2"></image>
				<!-- 失败 -->
				<image class="img" src="https://xyh-static-app.oss-cn-hangzhou.aliyuncs.com/storage_2/storage/qt/202405271604423042.png" mode="aspectFill" v-if="auditStatus==1"></image>
			</view>
			<template v-if="auditStatus==0">
				<view class="ing ss-m-t-100">审核中</view>
			</template>
			<template v-if="auditStatus==2">
				<view class="fail ss-m-t-100">审批失败</view>
				<view class="fail ss-m-t-20">驳回原因:{{remark}}</view>
			</template>
			<template v-if="auditStatus==1">
				<view class="fail ss-m-t-100">恭喜审核通过 </view>
				<!-- <view class="fail ss-m-t-20">请及时前往后台补充类目资质</view> -->
			</template>
			
			
			<su-fixed bottom v-if="auditStatus==2">
				<view class="s-p-t-20 ss-p-b-60 ss-flex justify-center">
					<button class="sss-reset-button botttom_view" @click="jump()">重新提交</button>
				</view>
				
			</su-fixed>
			
		</s-layout>
</template>

<script setup>
import {
	computed,
	reactive,
	onBeforeMount,
	ref
} from 'vue';
import {
	onLoad,
	onShow,
	onPageScroll,
	onPullDownRefresh
} from '@dcloudio/uni-app';

import sheep from '@/sheep';

const template = computed(() => sheep.$store('app').template?.home);

const auditStatus = ref(null);
const bd_id = ref(null);


const type = ref(null);//bd_id商户合作信息   serve商家入驻
const serve = ref(null);//bd_id商户合作信息   serve商家入驻

const options = ref({});



//审核备注
const remark = ref('');
//申请失败跳转
const jump =()=>{
	// edit  是否修改表单    type1个人-bd-bdm  2公司
	
	if(type.value=='bd_id'){
		sheep.$router.go(`/pages/commission/giveaway/info-bd`,{type:(bd_id.value==2||bd_id.value==3)?1:2,bd_id:bd_id.value,edit:true})//1个人
	}else if(type.value=='serve'){
		var obj={
			type:0,//0自己入驻  1代理帮忙入驻
			shopType:serve.value,//3鲸喜生活  1电商商家  2本地生活
		}
		if(options.value.inviteInfo){
			obj.inviteInfo=options.value.inviteInfo//填写电话号码带过去的信息
		}
		sheep.$router.go('/pages/commission/merchant/apply',obj);
	}
}
// 查看是否填写资料
	async function getStatus(bd_id,type){//type=bd_id  商户合作，serve商家入驻
		if(type=='bd_id'){
			const res =await sheep.$api.commission.giveaway.cooperation({bd_id})
				auditStatus.value=res.data[0]?.status
				remark.value = res.data[0]?.remark;
		}else if(type=='serve'){
			const res = await sheep.$api.commission.merchant.applyList({
				serve:bd_id,
				type:1,//1入驻  2进件
				mobile:sheep.$store('user').userInfo.mobile
			})
			auditStatus.value=res.data[0]?.status
			remark.value = res.data[0]?.remark;
			
		}
		
	}
	
	
onLoad((option)=>{
	options.value=option
	if(option.bd_id){
		type.value='bd_id'
		bd_id.value=option.bd_id
		getStatus(option.bd_id,'bd_id')
	}else if(option.serve){
		type.value='serve'
		serve.value=option.serve
		getStatus(option.serve,'serve')
	}
	
	//获取status参数
	// if(option && option.status){
	// 	auditStatus.value = option.status;
	// 	remark.value = option.remark;
	// }
	
	
	
})

</script>

<style lang="scss" scoped>
.main{
	display:flex;
	justify-content:center;
	align-items:center;
	height:300rpx;
	margin-left:80rpx;
	margin-right:80rpx;
	margin-top:300rpx;
	.img{
		width:100%;
	}
}
.ing{
	display:flex;
	justify-content:center;
	align-items:center;
	
	font-family: Source Han Sans;	
	font-weight:400;
	font-size:30rpx;
	line-height:28rpx;
	letter-spacing:1rpx;
	color:#666666;
}

.fail{
	display:flex;
	justify-content:center;
	align-items:center;
	
	font-family: Source Han Sans;	
	font-weight:400;
	font-size:30rpx;
	line-height:28rpx;
	letter-spacing:1rpx;
	color:#666666;
}
.botttom_view{
	width: 702rpx;
	height: 80rpx;
	background: #003288;
	border-radius: 49rpx;
	font-size: 32rpx;
	color: #FFFFFF;
	
	
}

</style>
